<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.Date"%>
<%@page import="iwpl.project.dao.*"%>
<%@page import="iwpl.project.entities.*"%>
<%@page import="iwpl.project.servlet.*"%>
<%@page import="iwpl.project.interfaces.*"%>
<%@page import="iwpl.project.entitymanagerhelper.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<script type="text/javascript" src="js/jquery-Source.js"></script>
		<script type="text/javascript" src="js/jquery-Validation.js"></script>
		<!--<script src="http://code.jquery.com/jquery-latest.js"></script>
		<script type="text/javascript"
			src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>-->

		<title>Offices</title>
		<link href="css/CommonCSS.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
	$(document).ready(function() {
		$("#Offices").validate();
	});
</script>
	</head>

	<body>
		<form class="cmxform" id="Offices" method="get"
			action="./servlet/Control_Office">
			<%
				String id = "";
				id = request.getParameter("id");
				OfficesDAO dao = new OfficesDAO();
				Offices Offi = dao.findById(Integer.parseInt(id));
			 %>
			<fieldset>
				<legend>
					Hello
				</legend>
				<p>
					<label for="DepartmentID">
						Department Name:
					</label>
					<select id="DepartmentID" name="CboDepartmentID">
						<option value="<%=Offi.getDepartments().getId()%>"><%=Offi.getDepartments().getDepartmentName() %></option>
						<%
							DepartmentsDAO DepartDAO = new DepartmentsDAO();
							List<Departments> list = DepartDAO.findAll();

							int i = 0;

							for (Iterator<Departments> it = list.iterator(); it.hasNext();) {
								Departments Depart = (Departments) it.next();
								out.println("<option value=\"" + Depart.getId()
										+ "\">");
								out.println(Depart.getDepartmentName());
								out.println("</option>");
							}
						%>
					</select>
				</p>
				<p>
					<label for="OfficeName">
						Office Name:
					</label>
					<input id="OfficeName" name="TxtOfficeName" class="required"
						minlength="5" maxlength="30" value="<%=Offi.getOfficeName() %>"/>
				</p>
				<p>
					<label for="Phone">
						Phone Number:
					</label>
					<input id="Phone" name="TxtPhone" value="<%=Offi.getPhone() %>"/>
				</p>
				<p>
					<label for="Address">
						Address:
					</label>
					<input id="Address" name="TxtAddress" class="required" value="<%=Offi.getAddress() %>"/>
					<input id="OfficeID" name="OfficeID" type="hidden" value="<%=Offi.getId() %>" />
				</p>
				<p>
					<input class="submit" type="submit" value="Submit" name="BtnUpdate"/>
				</p>
			</fieldset>
		</form>
	</body>
</html>